#ifndef __PWHDR_IOPOLLEPOLL_HPP__
#define __PWHDR_IOPOLLEPOLL_HPP__

namespace purewell
{
#if defined(HAVE_EPOLL_CTL)

#define __PW_EPOLL_SIZE (10240)
#define __PW_EPOLL_DISPATCH_SIZE (1024)

class PWIOPollEPoll : public PWIOPoll
{
public:
	explicit PWIOPollEPoll();
	virtual ~PWIOPollEPoll();

public:
	virtual bool add(PWFile* pfile, int event);
	virtual bool add(PWPairFile* pfile, size_t idx, int event);
	virtual bool modify(PWFile* pfile, int event);
	virtual bool modify(PWPairFile* pfile, size_t idx, int event);
	virtual bool modify(int fd, int event);
	virtual bool remove(PWFile* pfile);
	virtual bool remove(PWPairFile* pfile, size_t idx);
	virtual bool remove(int fd);
	virtual bool dispatch(int msec);
	virtual const char* getType(void) const;

	virtual bool initialize(void* param);
	virtual void destroy(void);

private:
	typedef std::map<int, PWFile*>	fdmap_t;
	typedef fdmap_t::iterator 		fdmap_itr;
	typedef fdmap_t::const_iterator fdmap_citr;

private:
	int					m_epoll_fd;
	struct epoll_event	m_epoll_events[__PW_EPOLL_DISPATCH_SIZE];
	fdmap_t				m_fds;

};
#else
typedef PWIOPollSelect PWIOPollEPoll;
#endif//HAVE_EPOLL_CTL
};//namespace purewell

#endif//!__PWHDR_IOPOLLEPOLL_HPP__

